package com.sanhuo.idms.dao;

import com.sanhuo.idms.entity.Dorm;
import com.sanhuo.idms.entity.DormElectric;
import com.sanhuo.idms.vo.TungComsumeAnalysisVO;
import com.sanhuo.triild.Basic.BaseMapper;
import com.sanhuo.triild.annotation.Mapper;
import com.sanhuo.triild.annotation.Select;

@Mapper
public interface DormElectricMapper extends BaseMapper<DormElectric> {

    @Select("select * from dorm_electric where dormId = #{dormId} ")
    DormElectric findByDorm(String dormId);

    @Select("select t.num tungNum,sum(consume) consume from dorm d join tung t join dorm_electric e on t.id = d.tungId " +
            " and d.id = e.dormId where t.id = #{tungId}")
    TungComsumeAnalysisVO analysisTung(String tungId);
}
